﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DTO;

namespace DAO
{
    public class LoaiTP_DAO
    {
        private DataProvider _provider = new DataProvider();

        public LoaiTP_DAO()
        {
            _provider.connect();
        }
        public DataTable GetTableLoaiTP()
        {
            string s = "Select * from LoaiTP";
            return _provider.executeQuery(s);
        }

        public void ThemLoaiTP(LoaiTP_DTO LTP)
        {
            string s = "INSERT INTO LoaiTP(MaLoaiTP,TenLoaiTP)VALUES('" + LTP.MaLoaiTP + "',N'" + LTP.TenLoaiTP+ "')";
            _provider.executeNonQuey(s);
        }
        public void XoaLoaiTP(string MaLTP)
        {
            string s = "DELETE FROM LoaiTP WHERE MaLoaiTP='" + MaLTP + "'"  ;
            _provider.executeNonQuey(s);
        }
        public void SuaLoaiTP(string MaLTP, string TenLTP)
        {
            string s = "UPDATE LoaiTP SET TenLoaiTP=N'" + TenLTP + "'WHERE MaLoaiTP='" + MaLTP + "'";
            _provider.executeNonQuey(s);

        }
        public int proc_Ins_ThanhPham(ThanhPham_DTO dto)
        {
            return _provider.proc_Ins_ThanhPham(dto);
        }
    }
}
